<template>
	<view class=" ">
		<u-popup :show="show" @close="close" mode="bottom" :round="10">
			<view class="mainpadding">
				<view class="textcenter bigtext">分享至</view>
				<view class="weixin" @click="sharewx"></view>
				<view class="margin_top1 textcenter ershil" @click="sharewx">微信好友</view>
			</view>
		</u-popup>
		<view class="beijt dingwei">
			<view class="zitibox">
				<view class="huangsetext textcenter">注册后在个人中心填写我的邀请码</view>
				<view class="zhonghtext textcenter">邀请码</view>
				<view class=" textcenter bightext">{{personInfo.invite_code}}</view>
				<view class="shilitu">
					<image :src="personInfo.invitation_image_text" mode=""></image>
				</view>
			</view>
			<view class="gudingdb" @click="show = true">
				<view class="yaoqhybtn">立即邀请</view>
			</view>

		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				show: false,
				personInfo: {
					invitation_image_text: "",
					invite_code: "",
				}
			}
		},
		onShow() {
			this.init()
		},
		methods: {
			init() {
				httpRequest.request('/api/user/index', 'POST', {}, false, false, true).then(res => {
					if (res.code == 1) {
						this.personInfo = res.data
					}
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			close() {
				this.show = false
				// console.log('close');
			},
			// 微信分享
			sharewx() {
				uni.share({
					provider: "weixin",
					scene: "WXSceneSession",
					type: 0,
					href: "https://fanyi.youdao.com/index.html#/", // 分享跳转的链接
					title: "服务商城", // 分享标题
					summary: "邀好友赚现金", // 分享内容文字
					imageUrl: "http://xunbo.yuntaiqi.com/uploads/20230301/dbe1e42b46a189375f57b1f336319ebf.jpg", //分享封面图片
					success: function(res) {
						console.log(res,"微信分享成功")
						// 此处是调起微信分享成功的回调
					},
					fail: function(err) {
						console.log(err,"微信分享失败")
						// 此处是调起微信分享失败的回调
					}
				});
			},
		}
	}
</script>

<style lang="scss" scoped>
	.weixin {
		margin: 50rpx auto 0;
		width: 84rpx;
		height: 84rpx;
		background-size: 100% 100%;
		background-image: url('../../static/image/system/daweixin.png');
	}

	.yaoqhybtn {
		width: 100%;
		height: 83rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 30rpx;
		font-family: Adobe Heiti Std;
		font-weight: normal;
		color: #FFFFFF;
		background-size: 100% 100%;
		background-image: url('../../static/image/system/yqhybtn.png');
	}

	.shilitu {
		margin: 60rpx auto 0;
		width: 282rpx;
		height: 282rpx;

		image {
			width: 100%;
			height: 100%;
		}
	}

	.bightext {
		font-size: 69rpx;
		font-family: Adobe Heiti Std;
		font-weight: normal;
		color: #F46C1A;
	}

	.zhonghtext {
		font-size: 47rpx;
		font-family: Adobe Heiti Std;
		font-weight: normal;
		color: #F46C1A;
	}

	.zitibox {
		position: absolute;
		left: 136rpx;
		top: 33%;
	}

	.huangsetext {
		font-size: 32rpx;
		font-family: Adobe Heiti Std;
		font-weight: normal;
		color: #F46C1A;
	}

	.beijt {
		width: 100%;
		background-size: 100% 100%;
		/*#ifdef H5*/
		height: calc(100vh - 88rpx);
		/*#endif*/
		/*#ifdef MP-WEIXIN || APP-PLUS*/
		min-height: 100vh;
		/*#endif*/
		background-image: url('../../static/image/system/yqhybjt.png');
	}
</style>
